package com.wlhse.controller;

import com.wlhse.dto.SupervisionTaskDto;
import com.wlhse.service.SupervisionTaskDetailService;
import com.wlhse.service.SupervisionTaskService;
import org.springframework.web.bind.annotation.*;

import javax.annotation.Resource;

@RestController("TaskSituationController")
@RequestMapping("/api/v1")

public class TaskSituationController {
    @Resource
    private SupervisionTaskService supervisionTaskService;

    @Resource
    private SupervisionTaskDetailService supervisionTaskDetailService;

    @RequestMapping(value = "/querytasksituation", method = RequestMethod.GET, produces = "application/json; charset=utf-8")
    public String queryTaskSituation(@ModelAttribute SupervisionTaskDto supervisionTaskDto) {
        return supervisionTaskService.queryTaskSituation(supervisionTaskDto);
    }

    @RequestMapping(value = "/querystafftasksituation", method = RequestMethod.GET, produces = "application/json; charset=utf-8")
    public String queryStaffTaskSituation(@ModelAttribute SupervisionTaskDto supervisionTaskDto) {
        return supervisionTaskService.queryStaffTaskSituation(supervisionTaskDto);
    }

    @RequestMapping(value = "/queryexecstafftasksituation", method = RequestMethod.GET, produces = "application/json; charset=utf-8")
    public String queryexecStaffTaskSituation(@ModelAttribute SupervisionTaskDto supervisionTaskDto) {
        return supervisionTaskService.queryexecStaffTaskSituation(supervisionTaskDto);
    }

    @RequestMapping(value = "/deleteTaskByCode", method = RequestMethod.DELETE, produces = "application/json; charset=utf-8")
    public String deleteTask(@ModelAttribute SupervisionTaskDto supervisionTaskDto) {
        return supervisionTaskService.deleteTask(supervisionTaskDto.getSupervisionTaskCode());
    }

    @RequestMapping(value = "/queryTaskDetail", method = RequestMethod.GET,produces = {"application/json;charset=UTF-8"})
    public String queryTaskDetail(@ModelAttribute SupervisionTaskDto supervisionTaskDto){
        return supervisionTaskDetailService.queryTaskDetail(supervisionTaskDto.getSupervisionTaskCode());
    }

    @RequestMapping(value = "/updateTaskStatus", method = RequestMethod.PUT,produces = {"application/json;charset=UTF-8"})
    public String updateTaskStatus(@RequestBody SupervisionTaskDto supervisionTaskDto){
        return supervisionTaskService.updateTaskStatus(supervisionTaskDto);
    }
}
